<template>
	<view class="">
		<now-group @clustering="clustering" :groupList="groupList"></now-group>
		<uni-popup ref="groupbooking" type="bottom">
			<view class="team">
				<i class="icon erricon" @tap="closestand">&#xe698;</i>
				<view class="team_one">
					一起参与拼团
				</view>
				<view class="team_product_title">
					花牛苹果约950g(超出按拼团价不差)
				</view>
				<view class="team_count_down">
					结束倒计时： <uni-countdowno :show-day="false" :hour="0" :minute="0" :second="currentGroup.countdown"></uni-countdowno>
				</view>
				<view class="team_user_header">
					<view class="header_pic">
						<image :src="Url+'mine/discount/header01.png'" mode=""></image>
						<view class="colonel">
							团长
						</view>
					</view>
					<view class="header_pic">
						<image :src="Url+'mine/discount/header02.png'" mode=""></image>
					</view>
					<view class="header_pic">
						<image class="query" :src="Url+'mine/index/query.png'" mode=""></image>
					</view>
				</view>
				<view class="ream_residue_num">
					还剩{{currentGroupPeople}}个名额抓紧参加吧
				</view>
				<view class="makesure_group">
					确认拼团
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import nowGroup from '@/components/nowgroup/nowgroup.vue'
	import uniPopup from '@/components/uni-popup/uni-popup.vue';
	import uniCountdowno from '@/components/uni-countdown/uni-countdown1.vue';
	import {
		collageList
	} from '@/common/productdetail.js';
	export default {
		components: {nowGroup, uniPopup, uniCountdowno},
		data () {
			return {
				Url:this.Imgurl,
				groupList:[],
				assemble_id:1,
				currentGroup:{},
				currentGroupPeople:0,
				name:''
			}
		},
		onLoad(options) {
			this.getData()
			this.assemble_id = options.id
		},
		methods: {
			getData(){
				console.log(this.assemble_id)
				collageList({assemble_id:this.assemble_id}).then(res => {
					if(res.code == 1){
						console.log(res)
						this.groupList = res.msg
					}
				}).catch()
			},
			// 参与拼团
			clustering (e) {
				console.log(e);
				this.currentGroup = e
				this.currentGroupPeople = this.currentGroup.num - this.currentGroup.user.length
				this.$refs.groupbooking.open()
			},
			closestand() {
				this.$refs.groupbooking.close()
			},
		}
	}
</script>

<style lang="less" scoped>
	.team {
		width: 100%;
		height: 680upx;
		background-color: #FFFFFF;
		border-top-left-radius: 20upx;
		border-top-right-radius: 20upx;
		position: relative;
		overflow: hidden;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		.erricon {
			font-size: 32upx;
			color: #999999;
			position: absolute;
			right: 20upx;
			top: 20upx;
			margin-bottom: 48upx;
			line-height: 32upx;
		}
		.team_one {
			font-size: 32upx;
			color: #333333;
			margin-bottom: 50upx;
		}
		.team_product_title {
			font-size: 24upx;
			color: #999999;
			line-height: 24upx;
			margin-bottom: 30upx;
		}
		.team_count_down {
			font-size: 28upx;
			color: #333333;
			margin-bottom: 35upx;
			display: flex;
			align-items: center;
		}
		.ream_residue_num {
			font-size: 24upx;
			color: #333333;
			margin-top: 60upx;
		}
		.makesure_group {
			width: calc(100% - 60upx);
			height: 90upx;
			margin: 0 auto 25upx;
			margin-top: 40upx;
			background: #FF2741;
			border-radius: 25upx;
			color: #FFFFFF;
			text-align: center;
			line-height: 82upx;
		}
		.team_user_header {
			display: flex;
			width: 380upx;
			justify-content: space-between;
			.header_pic {
				width: 108upx;
				height: 108upx;
				border: 2upx dashed #E1E1E1;
				border-radius: 50%;
				padding: 4upx;
				box-sizing: border-box;
				display: flex;
				align-items: center;
				justify-content: center;
				image {
					width: 100%;
					height: 100%;
					border-radius: 50%;
				}
				.query {
					width: 18upx;
					height: 27upx;
				}
			}
			.header_pic:first-child {
				border: none;
				background-color: #f73e2f;
				position: relative;
				.colonel {
					width: 82upx;
					height: 36upx;
					border-radius: 8upx;
					font-size: 24upx;
					color: #FFFFFF;
					text-align: center;
					line-height: 36upx;
					background: linear-gradient(to right,#f83008 0, #fa7968 100%);
					position: absolute;
					left: 50%;
					bottom: -10upx;
					transform: translate(-50%);
				}
			}
		}
	}
</style>
